/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package veluanasoft.modelo;

/**
 *
 * @author Ali Kate
 */
public class Item {

    private Wood wood;
    private int quantity;
    private double finalDeliveryTime;

    public Item(String typeOfWood, int quantity) {
        this.wood = new Wood(typeOfWood);
        this.quantity = quantity;
        calcFinalDeliveryTime();
    }

    public String getWoodName(){
        return wood.getTypeOfWood();
    }

    public int getQuantity() {
        return quantity;
    }

    public double getPriceOfWood() {
        return wood.getPrice();
    }

    public double getSubTotalPrice(){
        return getPriceOfWood()*getQuantity();
    }

    public double getFinalDeliveryTime() {
        return finalDeliveryTime;
    }
//
    private void calcFinalDeliveryTime(){
        double partialDeliveryTime;
        partialDeliveryTime = 0;
        if(quantity>1 && quantity<=100){
            partialDeliveryTime = 1*this.wood.getDeliveryTime();
        }else if(quantity>100 && quantity<=200){
            partialDeliveryTime = 2*this.wood.getDeliveryTime();
        }else if(quantity>200 && quantity<=300){
            partialDeliveryTime = 3*this.wood.getDeliveryTime();
        }else if(quantity>300 && quantity<=400){
            partialDeliveryTime = 4*this.wood.getDeliveryTime();
        }else if(quantity>400 && quantity<=500){
            partialDeliveryTime = 5*this.wood.getDeliveryTime();
        }

        this.finalDeliveryTime = partialDeliveryTime;

    }

}
